const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const categorySchema = new Schema({
    name: String,
    parentId: String,
    parentIds: [
        {
            type: mongoose.Schema.Types.ObjectId,
            ref: 'category',
        }
    ],
    cover: {
        type:String,
        default: 'noimage.jpg'
    },
    disabled: Boolean,
    description: {
        type: String,
        default: '暂无描述'
    },
    level: {
        type: Number,
        default: 0 // 默认一级分类
    },
    isCouponAllowed: Boolean,
    leaf: {
        type: Boolean,
        default: true // 默认是叶子节点
    },
})
const category = mongoose.model("category", categorySchema);
module.exports = category